<?php

namespace plugins\module_config\common;

use plugins\module_config\model\PluginApiIndexModel as Model;

/**



 *



 */

class AddTagsHtml
{

    public function run(&$params)
    {

        $view = $params['view'];

        $mo = new Model();

        if (!empty($params['file_name'])) {

            $params['file_name'] = $params['file_name'];

        } else {

            $file = $mo->getModuleTags($params['module_name']);

            $params['file_name'] = !empty($file) ? $file[0] : '';

        }

        //模块配置

        $config = $mo->getTagsConfig();

        $ts = array_keys($config['tags']);

        $tags = $view->keyTags($params['module_name'], $params['file_name']);

        $res = '';

        foreach ($tags as $key => $value) {

            if (!in_array($value, $ts)) {

                continue;

            }

            $res .= "<include file='table_config/" . $value . "'>";

        }

        echo $view->excuteDisplay($res);

    }

}
